<script type="text/javascript" language="javascript">
    function searchFilter(){
            var filter = '';
		var q='';

        // promoted
        if ($('#KeywordWebsiteId').val() != '') {
            filter +=  $('#KeywordWebsiteId').val();
        }

         //query string
        if($('#FilterQ').val() != '') {
            q=$('#FilterQ').val();
        }
        var loadUrl =  '<?php echo $this->Html->url('/keyword_hit_logs/index/') ?>';
        if (filter != '') {
            loadUrl += 'website:' + filter;
        }
        if (q != '') {
            if (filter == '') {
                loadUrl +='q:'+q;
            } else {
                loadUrl +='/q:'+q;
            }
        }

        window.location = loadUrl;
        return false;
    }
</script>
<div class="keywordHitLogs index">
        <?php echo $form->create('Keyword',array("action"=>"index"));?>
    <div class="fields clearfix">
        <h2>Search for keywords</h2>
        <p>
            <label class="small" for="user01">Keyword</label>
             <input id="FilterQ" type="text" value="<?php echo isset($q)?$q:''; ?>" class="sText small"/>
             Website: <?php  echo $form->input('website_id',array("div"=>false,"label"=>false,"class"=>"sSelect")); ?>
             <input type="button" class="butDef" value="Search"  onclick="searchFilter();"/>
            <span>Error, data not valid</span>
        </p>
    </div>
    <?php echo $form->end();?>
<table cellpadding="0" cellspacing="0" border="0" id="table" class="uiTable">
<tr>
	
	<th><h3><?php echo $paginator->sort('Keyword','Keyword.keyword');?></h3></th>
	<th><h3><?php echo $paginator->sort('Website','Website.website_name');?></h3></th>
	<th><h3><?php echo $paginator->sort('hit_count');?></h3></th>	
	<th><h3><?php echo $paginator->sort('hit_date');?></h3></th>
	
</tr>
<?php
$i = 0;
foreach ($keywordHitLogs as $keywordHitLog):
	$class = null;
	if ($i++ % 2 == 0) {
		$class = ' class="altrow"';
	}
?>
	<tr<?php echo $class;?>>
	
		<td>
			<?php echo $keywordHitLog['Keyword']['keyword']; ?>
		</td>
		<td>
			<?php echo $keywordHitLog['Website']['website_name']; ?>
		</td>
		<td>
			<?php echo $keywordHitLog['KeywordHitLog']['hit_count']; ?>
		</td>
		<td>
			<?php echo $keywordHitLog['KeywordHitLog']['hit_date']; ?>
		</td>
		
	</tr>
<?php endforeach; ?>
</table>
</div>
<?php echo $this->element('paging') ?>